﻿using GalaSoft.MvvmLight.Messaging;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace JiveMessenger.CustomControls
{
    /// <summary>
    /// Interaction logic for ChatLogsControl.xaml
    /// </summary>
    public partial class ChatLogsControl : UserControl
    {
        public ChatLogsControl()
        {
            InitializeComponent();
            Messenger.Default.Register<NotificationMessageAction<MessageBoxResult>>(this, msg =>
            {
                if (msg.Notification == "QueryDeleteLogFile" && msg.Sender == this.DataContext)
                {

                    var result = MessageBox.Show(msg.Target.ToString(), "Delete Log?", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
                    msg.Execute(result);
                }
            });
        }

        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            int columnIndex = 1;
            this.DataGridLogs.ColumnFromDisplayIndex(columnIndex).SortDirection =
    ListSortDirection.Descending;
        }
    }
}
